package pers.zhxu.extNLPM.util;

import java.util.Arrays;
import java.util.Calendar;
import java.util.List;

public record Edge(Vertex start,
                   Vertex end, Calendar time,
                   Float weight) {

    public static final int FORWARD = 1;
    public static final int BACKWARD = 2;
    public static final int TWOWAY = 3;

    public boolean contains(Vertex vertex) {
        return start == vertex | end == vertex;
    }

    public boolean startWith(Vertex vertex) {
        return start == vertex;
    }

    public Vertex another(Vertex vertex) {
        if (start == vertex)
            return end;
        return start;
    }

    public List<Vertex> getVertices() {
        return Arrays.asList(start, end);
    }
}
